package com.common.result;

import lombok.Data;
import org.springframework.security.config.annotation.authentication.configurers.userdetails.DaoAuthenticationConfigurer;


@Data
public class JsonResult {
    private int code;
    private String message;
    private Object data;


    public static JsonResult ok() {
        return new JsonResult(ResultEnum.SECCESS);
    }
    public static JsonResult ok(Object data) {
        return new JsonResult(ResultEnum.SECCESS,data);
    }

    public JsonResult(){
    };
    public JsonResult(ResultEnum resultEnum){
        this.code=resultEnum.getCode();
        this.message=resultEnum.getMessage();
        this.data=null;
    }
    public JsonResult(ResultEnum resultEnum,Object data){
        this.code=resultEnum.getCode();
        this.message=resultEnum.getMessage();
        this.data=data;
    }
    public JsonResult(String message){

        this.message=message;
    }
    public JsonResult(int code,String message){
        this.code=code;
        this.message=message;
    }


}
